<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>data-*</h1>
    <p>data-*是html5中推出的新特性，用于在标签上存储自定义属性。就是为了能方便地在标签上存储字符串值。</p>
    <div id="div1" data-id="1" data-name="奉先" data-sex="男">我是div</div>
    <script>
        let div = document.querySelector("#div1");

        // data-* 使用dataset对象来获取所有存储的数据
        let dataset = div.dataset;
        console.log(`id:${dataset.id},name:${dataset.name},sex:${dataset.sex}`);

        dataset.tel = "13258176100";
    </script>
</body>
</html>